﻿@using Invoicing.Web.Management
<div>
    <ul id="leftMenu">
        @if (Common.ShowMainMenu(new string[] { "BookOrder", "BookOrderList" }))
        {
            <li class="k-state-active"><b>预订管理</b>
                <ul>
                    @if (Common.AuthorizeCheck("BookOrder"))
                    {
                        <li><a href="/Orders/BookOrder/NewOrder/31">新采购订单</a></li>    
                        <li><a href="/Orders/BookOrder/NewOrder/32">新销售订单</a></li>
                    }
                    @if (Common.AuthorizeCheck("BookOrderList"))
                    {
                        <li style="border-bottom: dashed 1px #ccc;"></li>
                        <li><a href="/Orders/BookOrder">单据查询</a></li>    
                    }
                </ul>
            </li>    
        }
        @if (Common.ShowMainMenu(new string[] { "DealOrder", "DealOrderReturn", "DealOrderList" }))
        {
            <li class="k-state-active"><b>交易管理</b>
                <ul>
                    @if (Common.AuthorizeCheck("DealOrder"))
                    {
                        <li><a href="/Orders/DealOrder/NewOrder/1">新采购单</a></li>    
                        <li><a href="/Orders/DealOrder/NewOrder/2">新销售单</a></li>
                    }
                    @if (Common.AuthorizeCheck("DealOrderReturn"))
                    {
                        <li><a href="/Orders/DealOrder/NewOrder/3">采购退货</a></li>
                        <li><a href="/Orders/DealOrder/NewOrder/4">销售退货</a></li>
                    }
                    @if (Common.AuthorizeCheck("DealOrderList"))
                    {
                        <li style="border-bottom: dashed 1px #ccc;"></li>
                        <li><a href="/Orders/DealOrder">单据查询</a></li>    
                    }
                </ul>
            </li>    
        }
        @if (Common.ShowMainMenu(new string[] { "ProductOrder", "ProductBalance", "Repertory", "ProductOrderList" }))
        {
            <li><b>仓库管理</b>
                <ul>
                    @if (Common.AuthorizeCheck("ProductOrder"))
                    {
                        <li><a href="/Orders/ProductOrder/NewOrder/11">新入库单</a></li>
                        <li><a href="/Orders/ProductOrder/NewOrder/12">新出库单</a></li>
                    }
                    @if (Common.AuthorizeCheck("ProductBalance"))
                    {
                        <li><a href="/Orders/ProductOrder/Balance">盘存调拨</a></li>
                    }
                    <li style="border-bottom: dashed 1px #ccc;"></li>
                    @if (Common.AuthorizeCheck("Stock"))
                    {
                        <li><a href="/Products/Stock/">库存情况</a></li>    
                    }
                    @if (Common.AuthorizeCheck("ProductOrderList"))
                    {
                        <li><a href="/Orders/ProductOrder">单据查询</a></li>
                    }
                </ul>
            </li>
        }
        @if (Common.ShowMainMenu(new string[] { "PaidOrder", "Payments", "PaidOrderList" }))
        {
            <li><b>财务管理</b>
                <ul>
                    @if (Common.AuthorizeCheck("PaidOrder"))
                    {
                        <li><a href="/Orders/PaidOrder/NewOrder/21">新付款单</a></li>
                        <li><a href="/Orders/PaidOrder/NewOrder/22">新收款单</a></li>
                    }
                    <li style="border-bottom: dashed 1px #ccc;"></li>
                    @if (Common.AuthorizeCheck("Payments"))
                    {
                        <li><a href="/Financial/Payment/">帐号流水</a></li>
                    }
                    @if (Common.AuthorizeCheck("PaidOrderList"))
                    {
                        <li><a href="/Orders/PaidOrder">单据查询</a></li>    
                    }
                    @if (Common.AuthorizeCheck("DealStatistic"))
                    {
                        <li><a href="/Financial/Payment/DealStatistic">交易统计</a></li>    
                    }
                </ul>
            </li>
        }
        @if (Common.ShowMainMenu(new string[] { "ProductCategory", "ProductManage" }))
        {
            <li><b>产品目录</b>
                <ul>
                    @if (Common.AuthorizeCheck("ProductCategory"))
                    {
                        <li><a href="/Products/Category/">分类管理</a></li>
                    }
                    @if (Common.AuthorizeCheck("ProductManage"))
                    {
                        <li><a href="/Products/Product/">产品管理</a></li>
                    }
                    @if (Common.AuthorizeCheck("ProductRatio"))
                    {
                        <li><a href="/Products/Ratio/">单位系数</a></li>
                    }
                </ul>
            </li>
        }
        @if (Common.ShowMainMenu(new string[] { "CustomerManage", "CustomerCategory" }))
        {
            <li><b>成员管理</b>
                <ul>
                    @if (Common.AuthorizeCheck("CustomerManage"))
                    {
                        <li><a href="/Members/Customer/">客户管理</a></li>
                    }
                    @if (Common.AuthorizeCheck("CustomerCategory"))
                    {
                        <li><a href="/Members/CustomerCategory/">客户分类</a></li>
                    }
                </ul>
            </li>
        }
        
        @if (Common.ShowMainMenu(new string[] { "UserManage", "BankSetup" }))
        {
            <li><b>系统管理</b>
                <ul>
                    @if (Common.AuthorizeCheck("UserManage"))
                    {
                        <li><a href="/Accounts/User/">用户管理</a></li>
                    }
                    @if (Common.AuthorizeCheck("BankSetup"))
                    {
                        <li><a href="/Financial/Bank/">常用帐号设置</a></li>
                    }
                    @if (Common.AuthorizeCheck("WareHouseSteup"))
                    {
                        <li><a href="/Products/Warehouse/">仓库设置</a></li>
                    }
                </ul>
            </li>
        }
    </ul>
</div>

<script>
    $("#leftMenu").kendoPanelBar({
        expandMode: "single"
    });

    function LocatedMenu(main, sub) {
        var menu = $("#leftMenu").data("kendoPanelBar");
        var mm = $("#leftMenu li:contains('" + main + "')");
        //var sm = $("#leftMenu li ul li:contains('" + sub + "')");
        var sm = mm.find("ul li:contains('" + sub + "')");
        menu.select(sm);
        menu.expand(mm);
    }
</script>
